home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / patches / dopus511.lha / dopus_pch.lha / ARexx.lha / Arexx / trap-test.dopus5 < prev    next >
Text File  |  1995-06-19  |  898b  |  49 lines

  1. /*
  2. * A simple example of the new "dopus addtrap" and "dopus removetrap" commands
  3. *
  4. */
  5.  
  6. address DOPUS.1
  7. options results
  8. options failat 11
  9.  
  10. dopus front
  11.  
  12. if ~show('l','rexxsupport.library') then
  13.     call addlib('rexxsupport.library',0,-30,0)
  14.  
  15. call openport('test-handler')
  16.  
  17. lister new 'c:'
  18. handle=result
  19. lister wait handle
  20. lister set handle handler 'test-handler'
  21.  
  22. /* install traps */
  23. dopus addtrap copy 'test-handler'
  24. dopus addtrap move 'test-handler'
  25. dopus addtrap delete 'test-handler'
  26. dopus addtrap rename 'test-handler'
  27.  
  28. do while event ~= 'inactive'
  29.     call waitpkt('test-handler')
  30.  
  31.     packet=getpkt('test-handler')
  32.     event=getarg(packet,0)
  33.     handle=getarg(packet,1)
  34.     name=getarg(packet,2)
  35.     user=getarg(packet,3)
  36.     pathstr=getarg(packet,4)
  37.  
  38.     say 0 event
  39.     say 1 handle
  40.     say 2 name
  41.     say 3 user
  42.     say 4 pathstr
  43.  
  44.     call reply(packet,0)
  45. end
  46.  
  47. /* remove all traps for my handler */
  48. dopus remtrap '*' 'test-handler'
  49.